import 'package:appflutterhomeschool/res/styles.dart';
import 'package:appflutterhomeschool/ui/widgets/my_app_bar.dart';
import 'package:appflutterhomeschool/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///用户： ninetailedfox
///时间： 2020/6/14
///邮箱： 1037438704@qq.com
///功能： 申请反馈页面  0申请成功   1操作成功   2
class ApplyPage extends StatelessWidget {
  final int pageTag;

  ApplyPage({this.pageTag});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomPadding: false, //输入框抵住键盘
      appBar: MyAppBar2(title: getTitle()),
      body: Column(
        children: <Widget>[
          Container(
            margin: EdgeInsets.only(top: ScreenUtil().setWidth(311)),
            width: double.maxFinite,
            child: Image.asset(Utils.getImgPath("chenggong")),
          ),
          Text(
            getTips(),
            style: TextStyles.textDark37,
          ),
          Visibility(
            visible: pageTag == 1,
            child: SizedBox(height: ScreenUtil().setWidth(35)),
          ),
          Visibility(
            visible: pageTag == 1,
            child: Text("请耐心等待老师的审核", style: TextStyles.textGray30),
          ),
          GestureDetector(
            child: Container(
              margin: EdgeInsets.only(top: ScreenUtil().setWidth(70)),
              width: ScreenUtil().setWidth(310),
              height: ScreenUtil().setWidth(70),
              padding: EdgeInsets.only(bottom: 1),
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(10),
                  border: Border.all(
                    color: Colors.grey,
                    width: 0.5,
                  )),
              alignment: Alignment.center,
              child: Text(
                getButton(),
                style: TextStyles.textDark30,
              ),
            ),
            onTap: () => Navigator.pop(context),
          )
        ],
      ),
    );
  }

  // ignore: missing_return
  String getTitle() {
    switch (pageTag) {
      case 0:
        return "申请成功";
        break;
      case 1:
        return "操作成功";
    }
  }

  // ignore: missing_return
  String getTips() {
    switch (pageTag) {
      case 0:
        return "成功";
        break;
      case 1:
        return "审核操作成功";
    }
  }

  // ignore: missing_return
  String getButton() {
    switch (pageTag) {
      case 0:
        return "回到首页";
        break;
      case 1:
        return "继续审核";
    }
  }
}
